class Page5 extends egret.Sprite{
	private building:egret.Bitmap;
	private blink:egret.Bitmap;
	private arr_pic;

	private bg1:egret.Bitmap;
	private bg2:egret.Bitmap;
	private bg3:egret.Bitmap;
	public constructor() {
		super();
		this.initial();
	}
	public initial(){
		this.bg1=new egret.Bitmap(RES.getRes("bg5_png"));
		this.addChild(this.bg1);
		this.bg2=new egret.Bitmap(RES.getRes("bg55_png"));
		this.addChild(this.bg2);
		this.bg3=new egret.Bitmap(RES.getRes("bg555_png"));
		this.addChild(this.bg3);
		this.bg3.y=645;

		this.arr_pic=new Array();
		for(var z=1;z<=4;z++){
			var pic=new egret.Bitmap(RES.getRes("page5pic"+z+"_png"));
			this.addChild(pic);
			switch(z){
				case 1:pic.x=175+pic.width/2;pic.y=743+pic.height/2;pic.anchorOffsetX=pic.width/2;pic.anchorOffsetY=pic.height/2;break;
				case 2:pic.x=271;pic.y=846;break;
				case 3:pic.x=103;pic.y=907;break;
				case 4:pic.x=221;pic.y=981;break;

			}
			this.arr_pic.push(pic);
		}
		this.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.TB,this);

	}
	private TB(e:TouchEvent){
		this.touchEnabled=false;
		GoEvent.msg.dispatchEvent(new GoEvent("ChangePage","6"));
	}
	public End(){
		egret.Tween.get(this).to({alpha:0},600,egret.Ease.cubicOut);
	}

	public Show(){
			var This=this;
		setTimeout(function(){
			This.touchEnabled=true;
		},3000)


		var balaThis=this;
		this.alpha=0;
		egret.Tween.get(this).to({alpha:1},700,egret.Ease.cubicOut);


		this.bg1.alpha=0;this.bg2.alpha=0;this.bg3.alpha=0;
		this.bg2.x=-100;
		egret.Tween.get(this.bg1).to({alpha:1},600,egret.Ease.cubicOut);
		egret.Tween.get(this.bg2).wait(500).to({alpha:1,x:0},900,egret.Ease.cubicOut);
		egret.Tween.get(this.bg3).wait(700).to({alpha:1},900,egret.Ease.cubicOut);

		for(var z=0;z<this.arr_pic.length;z++){
			this.arr_pic[z].alpha=0;
			

			if(z==0){
				this.arr_pic[z].scaleX=1.5;this.arr_pic[z].scaleY=1.5;
				egret.Tween.get(this.arr_pic[z]).wait(1200+z*300).to({alpha:1,scaleX:1,scaleY:1},800,egret.Ease.cubicOut);
			}
			else if(z==1){
				this.arr_pic[z].x=271+40;
				egret.Tween.get(this.arr_pic[z]).wait(1200+z*300).to({alpha:1,x:271},800,egret.Ease.cubicOut);
				
			}
			else if(z==2){
				this.arr_pic[z].x=103-40;
				egret.Tween.get(this.arr_pic[z]).wait(1200+z*300).to({alpha:1,x:103},800,egret.Ease.cubicOut);
			}
			else{
				this.arr_pic[z].y+=50;
				egret.Tween.get(this.arr_pic[z]).wait(1200+z*300).to({alpha:1,y:this.arr_pic[z].y-50},800,egret.Ease.cubicOut);
			}
		}
	}
}